package com.one.common.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.one.common.R;

/**
 * Class Des:
 * Created by bjh on 2021/8/18.
 */
public class SelectPicBottomDialog extends BaseDialog implements View.OnClickListener {
    TextView tvLookPic;
    TextView tvModifyPic;
    TextView tvCancel;

    public SelectPicBottomDialog(Context context, SPClickInterface spClickInterface) {
        super(context, R.layout.dialog_sp_bottom);
        this.spClickInterface = spClickInterface;
    }

    @Override
    public void initView() {
        super.initView();
        setShowBottom();
        tvLookPic=view.findViewById(R.id.tv_take_photo);
        tvModifyPic=view.findViewById(R.id.tvModifyPic);
        tvCancel=view.findViewById(R.id.tvCancel);
        tvLookPic.setOnClickListener(this);
        tvModifyPic.setOnClickListener(this);
        tvCancel.setOnClickListener(this);
        this.setCanceledOnTouchOutside(true);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.tv_take_photo) {
            this.dismiss();
            spClickInterface.onTakePhoto();
        } else if (v.getId() == R.id.tvModifyPic) {
            this.dismiss();
            spClickInterface.OnSelectPic();
        } else if (v.getId() == R.id.tvCancel) {
            this.dismiss();
        }
    }

    public interface SPClickInterface {
        void onTakePhoto();

        void OnSelectPic();

    }

    private SPClickInterface spClickInterface;

    public void setSPClickListener(SPClickInterface itemClickListener) {
        this.spClickInterface = itemClickListener;
    }
}
